const { Sequelize } = require("sequelize");

module.exports = (app) => {
  app.beforeStart(async () => {
    const sequelize = new Sequelize(app.config.sequelize);
    app.context.sequelize = sequelize;
    const shouldSync = process.env.NODE_ENV !== "production";
    if (shouldSync) {
      await app.model.sync({
        alter: true,
        //  force: true,
      });
    }
    // await app.model.sync({
    //   force: true,
    // });
    
    // INSERT INTO `user` (`id`,`type`,`account`,`name`,`password`,`idNumber`,`isDeleted`, `createdAt`, `updatedAt`) VALUES (uuid(),DEFAULT,'admins', '管理员', '12345678',DEFAULT,DEFAULT, now(), now());

  });
};
